package com.expand.demo.expandable;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.expand.demo.R;
import com.expand.demo.expandable.utils.Constant;
import com.expand.demo.expandable.widget.TitleView;
import com.rich.widget.ExpandableTextView;
import com.rich.widget.MoreLineTextView;
import com.rich.widget.utils.DensityUtil;


/**
 * Expandable
 * mTvExpandableShort
 *
 * @Description TextView多文本折叠/展开效果
 * @Author 一花一世界
 */
public class MoreLineTextActivity extends AppCompatActivity {

    public static void jumpTo(Context context) {
        Intent intent = new Intent(context, MoreLineTextActivity.class);
        context.startActivity(intent);
    }

    private TitleView titleView;

    private MoreLineTextView mTvMoreLineLong;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        DensityUtil.init(this);
        setContentView(R.layout.activity_more_line_text);
        initView();
        //initData();
        showTextContent();
    }

    private void showTextContent() {
        mTvMoreLineLong.setText(getString(R.string.text_title_content));


    }

    private void initView() {
        titleView = findViewById(R.id.titleView);
        titleView.setAppTitle(getString(com.rich.widget.R.string.title));
        titleView.setLeftImageVisibility(View.GONE);
        mTvMoreLineLong = findViewById(R.id.tv_more_line_long);
    }

    private void initData() {
        mTvMoreLineLong.setText(Constant.content3);
        //mTvExpandableLong.setText(Constant.content4);
        String text = Constant.content4;
        SpannableString spannableString = new SpannableString(text);
        spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#FFEB78")), 1, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#E51C23")), 10, 20, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    }

}
